Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Adding and Subtracting Points and Vectors

QuickDraw 3D provides routines that you can use to add a vector to a point or subtract a vector from a point. For increased floating-point precision, it is better to use the vector-point subtraction routines than to reverse a vector and then add it to a point.

Q3Point2D_Vector2D_Add

You can use the Q3Point2D_Vector2D_Add function to add a two-dimensional vector to a two-dimensional point.

TQ3Point2D *Q3Point2D_Vector2D_Add (
                     const TQ3Point2D *point2D,
                     const TQ3Vector2D *vector2D,
                     TQ3Point2D *result);
point2D
A two-dimensional point.
vector2D
A two-dimensional vector.
result
On exit, a two-dimensional point that is the result of adding vector2D to point2D .

DESCRIPTION

The Q3Point2D_Vector2D_Add function returns, as its function result and in the result parameter, the two-dimensional point that is the result of adding the vector vector2D to the point point2D .

Q3Param2D_Vector2D_Add

You can use the Q3Param2D_Vector2D_Add function to add a two-dimensional vector to a two-dimensional parametric point.

TQ3Param2D *Q3Param2D_Vector2D_Add (
                     const TQ3Param2D *param2D,
                     const TQ3Vector2D *vector2D,
                     TQ3Param2D *result);
param2D
A two-dimensional parametric point.
vector2D
A two-dimensional vector.
result
On exit, a two-dimensional point that is the result of adding vector2D to param2D .

DESCRIPTION

The Q3Param2D_Vector2D_Add function returns, as its function result and in the result parameter, the two-dimensional parametric point that is the result of adding the vector vector2D to the parametric point param2D .

Q3Point3D_Vector3D_Add

You can use the Q3Point3D_Vector3D_Add function to add a three-dimensional vector to a three-dimensional point.

TQ3Point3D *Q3Point3D_Vector3D_Add (
                     const TQ3Point3D *point3D,
                     const TQ3Vector3D *vector3D,
                     TQ3Point3D *result);
point3D
A three-dimensional point.
vector3D
A three-dimensional vector.
result
On exit, a three-dimensional point that is the result of adding vector3D to point3D .

DESCRIPTION

The Q3Point3D_Vector3D_Add function returns, as its function result and in the result parameter, the three-dimensional point that is the result of adding the vector vector3D to the point point3D .

Q3Point2D_Vector2D_Subtract

You can use the Q3Point2D_Vector2D_Subtract function to subtract a two-dimensional vector from a two-dimensional point.

TQ3Point2D *Q3Point2D_Vector2D_Subtract (
                     const TQ3Point2D *point2D,
                     const TQ3Vector2D *vector2D,
                     TQ3Point2D *result);
point2D
A two-dimensional point.
vector2D
A two-dimensional vector.
result
On exit, a two-dimensional point that is the result of subtracting vector2D from point2D .

DESCRIPTION

The Q3Point2D_Vector2D_Subtract function returns, as its function result and in the result parameter, the two-dimensional point that is the result of subtracting the vector vector2D from the point point2D .

Q3Param2D_Vector2D_Subtract

You can use the Q3Param2D_Vector2D_Subtract function to subtract a two-dimensional vector from a two-dimensional parametric point.

TQ3Param2D *Q3Param2D_Vector2D_Subtract (
                     const TQ3Param2D *param2D,
                     const TQ3Vector2D *vector2D,
                     TQ3Param2D *result);
param2D
A two-dimensional parametric point.
vector2D
A two-dimensional vector.
result
On exit, a two-dimensional parametric point that is the result of subtracting vector2D from param2D .

DESCRIPTION

The Q3Param2D_Vector2D_Subtract function returns, as its function result and in the result parameter, the two-dimensional parametric point that is the result of subtracting the vector vector2D from the point param2D .

Q3Point3D_Vector3D_Subtract

You can use the Q3Point3D_Vector3D_Subtract function to subtract a three-dimensional vector from a three-dimensional point.

TQ3Point3D *Q3Point3D_Vector3D_Subtract (
                     const TQ3Point3D *point3D,
                     const TQ3Vector3D *vector3D,
                     TQ3Point3D *result);
point3D
A three-dimensional point.
vector3D
A three-dimensional vector.
result
On exit, a three-dimensional point that is the result of subtracting vector3D from point3D .

DESCRIPTION

The Q3Point3D_Vector3D_Subtract function returns, as its function result and in the result parameter, the three-dimensional point that is the result of subtracting the vector vector3D from the point point3D .


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |